import { createStore, applyMiddleware } from "redux";
import { createRootReducer } from "./reducers";
import Saga from "redux-saga"
import { createHashHistory } from "history"
// 将history属性加入redux
import { routerMiddleware } from "connected-react-router";
// redux-devtools
import { composeWithDevTools } from "redux-devtools-extension"
// sage 配置
import createSagaMiddleware from "redux-saga"
import rootSaga from "./sage/index"
const sagaMiddleware = createSagaMiddleware()


export const history = createHashHistory();


const store = createStore(createRootReducer(history), composeWithDevTools(applyMiddleware(routerMiddleware(history), sagaMiddleware)))


sagaMiddleware.run(rootSaga)

export default store